import KiRequest from "./request";
import localCache from '../utils/cache'
const request = new KiRequest({
  baseURL: 'http://152.136.185.210:5000',
  timeout: 5000,
  interceptors: {
    requestInterceptor(config) {
      const token = localCache.getCache('token')
      if (token && config.headers) {
        config.headers.Authorization = `Bearer ${token}` 
      }
      return config
    },
    requestErrorInterceptor(err) {
      return err
    },
    responseInterceptor(res) {
      return res
    },
    responseErrorInterceptor(err) {
      return err
    }
  }
})
export default request